<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./1.css">
  <style>
    .more {
      margin: 0 20px;
    }
  </style>
</head>

<body>
  <div id="app">
    <div class="home-box">
      <div class="home-top">
        <a class="more" v-for="(item,index) in list" :key="item.id" @mouseover="change(index)">{{item.name}}</a>
      </div>
      <ul v-if="active==0">
        <li class="items" v-for="item in list[active].data" :key="item.id">
          <a href="#">
            <img :src="item.img" class="img1">
            <p class="name2">{{item.name}}</p>
            <p class="desc2">{{item.body}}</p>
            <p class="price2">{{item.price}}元起
              <del>{{item.price}}元</del>
            </p>
          </a>
        </li>
      </ul>
      <ul v-if="active==1">
        <li class="items" v-for="item in list[active].data" :key="item.id">
          <a href="#">
            <img :src="item.img" class="img1">
            <p class="name2">{{item.name}}</p>
            <p class="desc2">{{item.body}}</p>
            <p class="price2">{{item.price}}元起
              <del>{{item.price}}元</del>
            </p>
          </a>
        </li>
      </ul>
    </div>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
  <script>
    const app = new Vue({
      el: "#app",
      data: {
        list: [
          {
            id: 1,
            name: '爱生活',
            data: [
              { id: 1, name: '肯德基', body: '疯狂星期四疯狂星期四疯狂星期四疯狂星期四', price: 5999, img: 'images/2.png' },
              { id: 2, name: '星巴克', body: '第二杯半价第二杯半价第二杯半价第二杯半价', price: 5999, img: 'images/7.png' },
              { id: 3, name: '麦当劳', body: '打倒肯德基打倒肯德基打倒肯德基打倒肯德基', price: 5999, img: 'images/OIP-C (1).jpg' },
              { id: 4, name: '肯德基', body: '疯狂星期四疯狂星期四疯狂星期四疯狂星期四', price: 5999, img: 'images/2.png' },
              { id: 5, name: '星巴克', body: '第二杯半价第二杯半价第二杯半价第二杯半价', price: 5999, img: 'images/OIP-C (2).jpg' },
              { id: 6, name: '麦当劳', body: '打倒肯德基打倒肯德基打倒肯德基打倒肯德基', price: 5999, img: 'images/2.png' },
              { id: 7, name: '肯德基', body: '疯狂星期四疯狂星期四疯狂星期四疯狂星期四', price: 5999, img: 'images/OIP-C (5).jpg' },
              { id: 8, name: '星巴克', body: '第二杯半价第二杯半价第二杯半价第二杯半价', price: 5999, img: 'images/2.png' },
            ]
          },
          {
            id: 2,
            name: '爱代码',
            data: [
              { id: 1, name: '肯德基', body: '疯狂星期四疯狂星期四疯狂星期四疯狂星期四', price: 5999, img: 'images/2.png' },
              { id: 7, name: '肯德基', body: '疯狂星期四疯狂星期四疯狂星期四疯狂星期四', price: 5999, img: 'images/OIP-C (5).jpg' },
              { id: 8, name: '星巴克', body: '第二杯半价第二杯半价第二杯半价第二杯半价', price: 5999, img: 'images/2.png' },
              { id: 5, name: '星巴克', body: '第二杯半价第二杯半价第二杯半价第二杯半价', price: 5999, img: 'images/OIP-C (2).jpg' },
              { id: 6, name: '麦当劳', body: '打倒肯德基打倒肯德基打倒肯德基打倒肯德基', price: 5999, img: 'images/2.png' },
              { id: 2, name: '星巴克', body: '第二杯半价第二杯半价第二杯半价第二杯半价', price: 5999, img: 'images/7.png' },
              { id: 3, name: '麦当劳', body: '打倒肯德基打倒肯德基打倒肯德基打倒肯德基', price: 5999, img: 'images/OIP-C (1).jpg' },
              { id: 4, name: '肯德基', body: '疯狂星期四疯狂星期四疯狂星期四疯狂星期四', price: 5999, img: 'images/2.png' },
            ]
          },
        ],
        active: 0
      },
      methods: {
        change(res) {
          this.active = res
        }
      }
    })

  </script>
</body>

</html>